package com.cet.designapplication.decorator;

import com.cet.designapplication.pojo.Order;
import com.cet.designapplication.service.inter.OrderServiceInterface;

import java.math.BigDecimal;

/**
 * @author NSOC
 */
public abstract class AbstractOrderServiceDecorator implements OrderServiceInterface {

    private OrderServiceInterface orderServiceInterface;

    public void setOrderServiceInterface(OrderServiceInterface orderServiceInterface) {
        this.orderServiceInterface = orderServiceInterface;
    }

    @Override
    public Order createOrder(String productId) {
        return orderServiceInterface.createOrder(productId);
    }

    @Override
    public Order pay(String orderId) {
        return orderServiceInterface.pay(orderId);
    }

    @Override
    public Order send(String orderId) {
        return orderServiceInterface.send(orderId);
    }

    @Override
    public Order receive(String orderId) {
        return orderServiceInterface.receive(orderId);
    }

    @Override
    public String getPayUrl(String orderId, BigDecimal price, Integer payType) {
        return orderServiceInterface.getPayUrl(orderId, price, payType);
    }

    /**
     * 更新积分并发放红包
     * @param productId 产品标识
     * @param serviceLevel 服务级别 0-正常 1-延迟发放 2 暂停服务
     * @param price 红包金额
     */
    protected abstract void updateScoreAndSendRedPaper(String productId, int serviceLevel, BigDecimal price);
}
